import request from '@/utils/request'

/**
 * 添加公司
 * @param {Object} data
 * @returns
 */
export function addCompany(data) {
  return request({
    url: '/tissue/company/addCompany',
    headers: { repeatSubmit: false },
    method: 'post',
    data
  })
}
/**
 * 获取所有公司，下拉列表
 * @param {String} companyId
 * @returns
 */
export function getAllCompany(companyId) {
  return request({
    url: '/tissue/company/conditionsCompany',
    method: 'get',
    params: { companyId }
  })
}

/**
 * 公司查询
 * @param {Object} params
 * @returns
 */
export function getListCompany(params) {
  return request({
    url: '/tissue/company/listCompany',
    method: 'get',
    params
  })
}

/**
 * 公司详情
 * @param {String} companyId
 * @returns
 */
export function getCompanyInfo(companyId) {
  return request({
    url: '/tissue/company/oneConditions',
    method: 'get',
    params: { companyId }
  })
}

/**
 * 更新公司信息
 * @param {Object} data
 * @returns
 */
export function updateCompany(data) {
  return request({
    url: '/tissue/company/updateCompany',
    method: 'post',
    data
  })
}

/**
 * 禁、启用公司
 * @param {Object} params
 * @returns
 */
export function disableCompany(params) {
  params.enabled = params.enabled == '1' ? '0' : '1'

  return request({
    url: '/tissue/company/companyProhibit',
    method: 'get',
    params
  })
}
